#!/usr/bin/python
import re

class Sites_plugin:
    """
    Match
    #define GUID_######## "########" /* This is comments. */
    """
    reg_guid_definition = '\#define GUID\_[A-Z]{1,8}\s+\"[A-Z]{1,8}\"\s+\/\* .+ \*\/'
    
    """
    Match 
    { "HTTP", "User-Agent", "*****.***", GUID_########, 1 },
    { "TLS", "Host", "*****.***", GUID_########, 0 },
    """
    reg_rule = '\{ \"(HTTP|TLS)\"\, \"(Host|Referer)\"\, \".+\"\, GUID\_[A-Z]{1,8}\, [01] \}\,'
    
    def valid_guid_definition(self, definition):
        return re.match(Sites_plugin.reg_guid_definition, definition) != None or False
        
    def valid_rules(self, rule):
        return re.match(Sites_plugin.reg_rule, rule) != None or False
